const API = require("../../http/API")
const http = require("../../http/http")

Page({

  /**
   * 页面的初始数据
   */
  data: {
    top_title: [{ tit: "最新" }, { tit: "入门" }, { tit: "进阶" }, { tit: "免费" }, { tit: "图文" }, { tit: "兑换" }, { tit: "专题" }],
    GroupList: [],
    Toggle: true,
    Cours: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    http(API.GroupList).then(res => {
      this.setData({
        GroupList: res.data.course_subjects
      })
      console.log(this.data.GroupList);
    })
    http(API.CourseList).then(res => {
      this.setData({
        Cours: res.data.data
      })
      console.log(this.data.Cours);
    })
  },
  toggle() {

    this.setData({
      Toggle: !this.data.Toggle

    })
    console.log(this.data.Toggle);
  }
})